package thirdPartyUtils;

import lombok.extern.slf4j.Slf4j;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;

import java.io.IOException;
import java.util.ArrayList;

@Slf4j
public class JasyptTest {
    public static void main(String[] args) throws IOException {
        //对应配置文件中对应的根密码
        System.setProperty("jasypt.encryptor.password", "ubop");
        StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
        encryptor.setPassword("ubop");  //设置jasypt密码
        //加密方法
        System.out.println(encryptor.encrypt("ums_ywyyzx"));
        System.out.println(encryptor.encrypt("ywyy_CkDe94dfV_0F"));
        //解密方法
        System.out.println(encryptor.decrypt(encryptor.encrypt("test")));

        System.out.println(encryptor.decrypt("45DcLlGig9lJ5mwlIAPnXg=="));
        System.out.println(encryptor.decrypt("NkLEPtrBMExq9UQ+8Njh1ePnCtE0WsKL"));
//        System.out.println(encryptor.decrypt("pl/5jFEW5uavFcMQBIFrIhAs4bUMwXC8"));

        //springboot
//        StringEncryptor stringEncryptor = new DefaultLazyEncryptor(new StandardEnvironment());
//        //加密方法
//        System.out.println(stringEncryptor.encrypt("test"));
//        //解密方法
//        System.out.println(stringEncryptor.decrypt(stringEncryptor.encrypt("test")));
//        //imENTO7M8bLO38LFSIxnzw==
//        System.out.println(stringEncryptor.decrypt("KX34gPBBOaHwpxSXU0+KvA=="));

        ArrayList<Object> objects = new ArrayList<>();
        ArrayList<Object> o2 = new ArrayList<>();

        objects.addAll(o2);
    }
}
